﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DinnerParty2
{
    public partial class Form1 : Form
    {
        Dinner dinnerParty = new Dinner();
        public Form1()
        {
            InitializeComponent();
            dinnerParty.NumberOfpeople = 5;
            dinnerParty.setHealthyOption(cbHealthy.Checked);
            dinnerParty.calculateCostOfDecorations(cbFancy.Checked);
            displayDinnercost();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
       

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            dinnerParty.NumberOfpeople = (int)numericUpDown1.Value;
            
            displayDinnercost();
        }

        private void cbHealthy_CheckedChanged(object sender, EventArgs e)
        {

            dinnerParty.setHealthyOption(cbHealthy.Checked);
            displayDinnercost();
        }

        private void cbFancy_CheckedChanged(object sender, EventArgs e)
        {
            dinnerParty.calculateCostOfDecorations(cbFancy.Checked);
            displayDinnercost();
        }
        private void displayDinnercost()
        {
            decimal cost = dinnerParty.calculateCost(cbHealthy.Checked);
            
            textBox1.Text = cost.ToString("c");
        }

    }
}
